﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IntelligentRouteAssist
{
    public enum RouteType
    {
        MOST_DISCOUNT,
        SELDOM_GO,
        CLASSIC
    }

    public class ZRoute
    {
        public List<RouteNode> nodes { get; set; } 
        public ZRoute()
        {
            nodes = new List<RouteNode>();
        }

        public void ArrangeNodes(ZTimeline startTime)
        {
            ZTimeline defaultDeadShoppingTime = new ZTimeline()
            {
                atHour = 21,
                atMin = 00
            };
            ZTimeline s_time = startTime;
            s_time.deadTime = defaultDeadShoppingTime;
            nodes.ForEach(n =>
                {
                    n.startTime = s_time;
                    
                    //Compute End Time
                    ZTimeline endTime = s_time.AddMin(n.Duration());
                    n.SetEndTime(endTime);

                    s_time = endTime.AddMin(60);
                });
        }
    }
}
